{include file='header.html'}

    <div class="hqindex"> 
      <h1>Активные тендеры </h1>
    </div>
    <div class="filtrs"> Фильтр 
    <form method="post" action="{geturl action='index'}" id="filter-form">

	
   <select name='cats_filter[]' id='cats_filter' data-placeholder="Выбрать категорию" class="chosen-select_cat" multiple style="width:225px;" tabindex="4">
<option value="0" ></option>
{foreach from=$cats item=cat}
{if in_array($cat->getId(),$cats_filter)}
<option value="{$cat->getId()}" selected='selected'>{$cat->name}</option>
{else}
<option value="{$cat->getId()}">{$cat->name}</option>
{/if}
{/foreach}
</select>
   
<select name='projects_filter[]' id='projects_filter' data-placeholder="Выбрать проект" class="chosen-select_project" multiple style="width:225px;" tabindex="4">
<option value='0'></option>
{foreach from=$projects item=project}
{if in_array($project->getId(), $projects_filter)}
<option value="{$project->getId()}" selected='selected'>{$project->name}</option>
{else}
<option value="{$project->getId()}">{$project->name}</option>
{/if}
{/foreach}
</select>
    
          
           <button type="submit" class="send" >Фильтр</button>
     
   
 </form>
   <br>   
   Поиск<form method="post" action="{geturl action='index'}" id="filter-form" style="margin-left:63px;">
       <input type="text" id="form_search" name="search" value="Поиск" onfocus="if (this.value=='Поиск') this.value=''" onblur="if (this.value==''){ldelim}this.value='Поиск'{rdelim}" style="width: 443px;padding: 5px;"/>
   <button type="submit" class="send" >Поиск</button>
   </form>
<!--	 Сортировать {if $sort=='name'}
            <a href="?sort=name&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Название</a>
            {else}
            <a href="?sort=name&order={if $order=='desc'}asc{else}desc{/if}">Название</a>
            {/if}
             {if $sort=='start_date'}
            <a href="?sort=start_date&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Дата добавления</a>
            {else}
            <a href="?sort=start_date&order={if $order=='desc'}asc{else}desc{/if}">Дата добавления</a>
            {/if}
             {if $sort=='end_date'}
            <a href="?sort=end_date&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Дата окончания</a>
            {else}
            <a href="?sort=end_date&order={if $order=='desc'}asc{else}desc{/if}">Дата окончания</a>
            {/if}-->
    </div>



    <div class="table"> 
      <div class="row"> <span class="td4 h1top"> </span> <span class="td5"> </span> 
      </div>
      <div class="row"> <span class="td4"> 
	  {foreach from=$tenders item=tender}
        <div class="tenders"> 
          <h2>{if $authenticated}<a href="{geturl route='viewtender' id=$tender->getId()}">{$tender->name}</a>{else}{$tender->name}{/if}</h2>
          <div  class="flleft"> 
            <p><span>Проект:</span> {$tender->project->name}</p>
            <p><span>Ответственный:</span> {$tender->manager}</p>
          </div>
          <div class="flright"> 
            <p><span>Начало:</span> {$tender->start_date|date_format:"%d %B %Y"}</p>
            <p><span>Окончание:</span> {$tender->end_date|date_format:"%d %B %Y"}</p>
          </div>
          <div class="clear"></div>
        </div>
       {/foreach}
       {if $pages != 1}
        <div class="pages">
            {section loop=$pages name=page}
                {assign var=p value=$smarty.section.page.index_next}
                {if $p == $page}
                    <span>{$p}</span>
                {else}
                   {if $p==1}
                    <a href="{geturl action='index'}">{$p}</a>
                    {else}
                   <a href="{geturl route='pagetender' page=$p}">{$p}</a>
                    {/if}
              
                   
                {/if}
            {/section}
        </div>
       {/if}
        </span> <span class="td5"> </span> </div>
      <div class="row"> <span class="td4"> 
        <div class="botline mgbottd"></div>
        </span> <span class="td5"> </span> </div>
    </div>

<div style='clear: both'></div>
{include file='footer.html'}